import 'dart:collection';
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'package:smart_translator/app/style/widget_style.dart';
import '../controllers/mine_profile_controller.dart';

class pageWidgets {

  static void showDialogPart(BuildContext context,text,calback) {
    String _text = text; // 用于存储文本框输入的文本

    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text('修改昵称',style:TextStyle(fontSize: 14)),
          content: TextField(
            onChanged: (value) {
              _text = value; // 更新_text变量的值以存储输入的文本
            },
            decoration: InputDecoration(hintText: '请输入内容',hintStyle:TextStyle(fontSize: 14)),
          ),
          actions: <Widget>[
            TextButton(
              child: Text('取消'),
              onPressed: () {
                Navigator.of(context).pop(); // 关闭对话框并返回null（不设置返回值）
              },
            ),
            TextButton(
              child: Text('确认'),
              onPressed: () async {
                await calback(_text);
                Navigator.of(context).pop(_text); // 关闭对话框并返回输入的文本
              },
            ),
          ],
        );
      },
    ).then((value) {
      if (value != null) {
        print('value2 $value');

      }
    });
  }

}
